<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<style>
.bt_view {
	background-color: #8099de;
	border: 1px solid #999;
	width: 80px;
	height: 20px;
	border-radius: 8px;
	border: none;
	margin: 0 0 0 5px;
	font-weight: bold;
	font-size: 0.9em;
	color: #FFF;
	background-image: url(../images/member/dup.jpg);
	background-repeat: repeat-x;
	background-position: center center;
}
.bt_view_small {
	background-color: #8099de;
	border: 1px solid #999;
	width: 40px;
	height: 18px;
	border-radius: 8px;
	border: none;
	margin: 0 0 0 5px;
	font-weight: bold;
	font-size: 0.8em;
	color: #FFF;
	background-image: url(../images/member/dup.jpg);
	background-repeat: repeat-x;
	background-position: center center;
}
</style>

<script>
	function addSubject() {
		document.getElementById("modify").submit();
	}
</script>

<div id="member_page">
	<header>
		<div id="title">
			<b>Information</b>
		</div>

		<div id="bar"></div>
	</header>

	<section id="member_form">
		<form:form id="modify" action="modifyCourseAction"
			modelAttribute="course">
			<table id="table-simple" summary="사용자 등록 결과">
				<form:input path="courseId" type="hidden"
					value="${course.courseId }" />
				<tr>
					<th width="120">코스번호</th>
					<td width="460">${course.courseId }</td>
				</tr>
				<tr>
					<th>코스이름</th>
					<td><form:input path="courseName" type="text"
							value="${course.courseName }" /></td>
				</tr>
				<tr>
					<th>강의실</th>
					<td><form:input path="classRoom" type="text"
							value="${course.classRoom }" /></td>
				</tr>
				<tr>
					<th>시작날짜</th>
					<td><form:input path="startDate" type="text"
							value="${course.startDate }" /></td>
				</tr>
				<tr>
					<th>종료날짜</th>
					<td><form:input path="endDate" type="text"
							value="${course.endDate }" /></td>
				</tr>
				<tr>
					<th>과목 리스트</th>
					<td>

						<table>
							<c:forEach items="${course.subjectList }" var="subject">
								<tr>
									<td>${subject.title }</td>
									<td><a
										href="<c:url value="/course/removeSubject?courseId=${course.courseId }&subjectId=${subject.subjectId }"/>">
										<button class="bt_view_small">삭제</button></a>
									</td>
								</tr>
							</c:forEach>
						</table>

					</td>
				</tr>
			</table>
		</form:form>
		<br>

		<form method="post" action="addSubject">
			<input name="courseId" type="hidden" value="${course.courseId }" />
			<select name="subjectId">
				<c:forEach items="${subjects }" var="subject">
					<option value="${subject.subjectId }">${subject.title }</option>
					<br>
				</c:forEach>
			</select> <input type="submit" value="추가" class="bt_view_small" />
		</form>

		<p align="center">
			<input type="button" value="수정하기" onClick="addSubject()" class="bt_view" />
	</section>
</div>